/*
 * 单个排行节点对象
 * 用于重写shareNode.js中的shareNode节点对象
 */
let notLoginNode = function () {
};
notLoginNode.prototype.getOneNode = function (data) {
    let div = document.createElement("div");
    div.className = "notLoginPic";
    div.innerHTML =
        '<div class="notLoginPic-header"><img class="notLoginPic-img" src="' + data.images[0].thumbUrl + '"></div>\n' +
        '<div class="notLoginPic-middle"><img class="notLoginPic-logo" src="' + data.author.userLogo.thumbUrl + '"><span class="notLoginPic-name">' + data.author.userName + '</span></div>\n' +
        '<div class="notLoginPic-bottom">\n' +
        '<div class="notLoginPic-title">' + data.description + '</div>\n' +
        '<div class="notLoginPic-time">' + data.createTime + '</div>\n' +
        '</div>';
    return div;
};
/**************** rank页中栏分享的自适应**********/
let notLoginAdjustScreen = function () {
    let nodeArr = [document.querySelectorAll(".notLoginCont")[0], document.querySelectorAll(".notLoginCont")[1], document.querySelectorAll(".notLoginCont")[2], document.querySelectorAll(".notLoginCont")[3]],
        notLoginPare = getClass("notLogin-inner")[0],
        length,
        width;
    if (notLoginPare.clientWidth > 1100) {
        width = 250;
        length = 4;
    } else if (notLoginPare.clientWidth > 930) {
        width = 250;
        length = 3;
    } else if (notLoginPare.clientWidth > 585) {
        width = 250;
        length = 2;
    } else {
        width = (notLoginPare.clientWidth - 32 - 17) / 2;
        if (width > 250) {
            width = 250;
        }
        length = 2;
    }
    for (let i = 0; i < nodeArr.length; i++) {
        nodeArr[i].style.width = width + "px";
    }
    return length;
};

/******************左侧模态框显示**********************/
/*** 以下为主方法 **/
let initRun=function () {
    //左边菜单栏
    FadeModelShowToWindow.init("resize");
    /*导航条的跳转方法*/
    let url = "/share/getPublicList",
        data_send = {
            pageNum: 1,
            pageSize: 12,
            orderByField: "id",
            userId: 0,
            ascend: true
        },
        method = "POST",
        nodeName1 = "notLogin-inner";
    let shareArray = new shareArr();
    shareArray.setPlayNode([document.querySelectorAll(".notLoginCont")[0], document.querySelectorAll(".notLoginCont")[1], document.querySelectorAll(".notLoginCont")[2], document.querySelectorAll(".notLoginCont")[3]]);
    shareArray.shareNode = new notLoginNode();
    MainToPage.setBase(data_send, url, method, "Json");
    MainToPage.setNodeListToShow(shareArray, notLoginAdjustScreen);
    MainToPage.setFirstRequest(false);
    MainToPage.setWindowResize(nodeName1);
};
initRun();
